#include "Job.h"

int Job::GetId()
{
    int nId;
    m_sem.Wait();
    nId = m_nId;
    m_sem.Post();
    return nId;
}

void Job::SetId(int nId)
{
    m_sem.Wait();
    m_nId = nId;
    m_sem.Post();
}

void* Job::GetData()
{
    void* pData;
    m_sem.Wait();
    pData = m_pData;
    m_sem.Post();
}

void Job::SetData(void* pData)
{
    m_sem.Wait();
    m_pData = pData;
    m_sem.Post();
}

Job::Status Job::GetStatus()
{
    Job::Status status;
    m_sem.Wait();
    status = m_status;
    m_sem.Post();
    return status;
}

void Job::SetStatus(Status status)
{
    m_sem.Wait();
    m_status = status;
    m_sem.Post();
}

bool Job::IsDone()
{
    bool bDone;
    m_sem.Wait();
    bDone = m_bDone;
    m_sem.Post();
    return bDone;
}

void Job::SetDone(bool bDone)
{
    m_sem.Wait();
    m_bDone = bDone;
    m_sem.Post();
}

Thread* Job::GetWorkThread()
{
    Thread* pThread = NULL;
    m_sem.Wait();
    pThread = m_pThread;
    m_sem.Post();
    return pThread;
}

void Job::SetWorkThread(Thread* pThread)
{
    m_sem.Wait();
    m_pThread = pThread;
    m_sem.Post();
}

